package com.yang.springboot.service.impl;

import com.yang.springboot.mapper.StudentMapper;
import com.yang.springboot.model.Student;
import com.yang.springboot.service.IStudentService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author yanwei.yang
 * @date 2021/11/15 17:43
 * @description:
 */
@Service
public class StudentServiceImpl implements IStudentService {

    @Resource
    private StudentMapper mapper;

    @Override
    public Student getById(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Transactional
    @Override
    public int updateById(Student student) {
        int i = mapper.updateByPrimaryKeySelective(student);

        int b = 10 / 0;
        return i;
    }
}
